# 先运行UDP服务器端，新python打开UDP客户端，模拟实现服务器与客户端的交互

# from socket import socket, AF_INET, SOCK_DGRAM
#
# # 创建socket对象
# send_socket = socket(AF_INET, SOCK_DGRAM)
# # 指定接收方的IP地址和端口
# ip_port = ('127.0.0.1', 8888)
#
# # 发送数据
# send_socket.sendto('Welcome.'.encode('utf-8'), ip_port)
#
# # 接收数据
# data, addr = send_socket.recvfrom(1024)
# print('接收到的数据为：', data.decode('utf-8'))
#
# # 关闭
# send_socket.close()






